<template>
  <div id="play-contain">
    <van-nav-bar title="音乐" left-text="返回" right-text="分享" left-arrow @click-left="$router.back()" @click-right="onClickRight" />
    {{ musicName }}
  </div>
</template>

<script>
import { getDetailAPI } from '@/api/play.js'

export default {
  name: 'Play',
  data () {
    return {
      musicName: ''
    }
  },
  created () {
    this.getMusicList()
  },
  methods: {
    onClickRight () {
      console.log('分享成功！')
    },
    async getMusicList () {
      try {
        const { data: res } = await getDetailAPI(this.$route.params.id)
        // console.log(res)
        this.musicName = res.songs[0].name
      } catch (error) {
        alert('出错了！')
      }
    }
  }
}
</script>

<style lang='less' scoped>
</style>
